/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Config;

import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author minhtrungn
 */
public class Connection {

    public static java.sql.Connection getConnection() throws ClassNotFoundException {
        java.sql.Connection con = null;
        try {
            String url = "jdbc:sqlserver://localhost:1433;databaseName=" + Constants.DATABASE;
            Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
            con = java.sql.DriverManager.getConnection(url, Constants.USERNAME, Constants.PASSWORD);

        } catch (SQLException ex) {
            Logger.getLogger(Connection.class.getName()).log(Level.SEVERE, null, ex);
        }
        return con;
    }
}
